package com.wtwd.campus.receiver;

import com.wtwd.campus.entity.MqGeneralSwitchResult;
import com.wtwd.campus.service.IRMFeignClientService;
import com.wtwd.campus.service.InjectFeignService;
import org.springframework.beans.factory.annotation.Autowired;

public class SetWhiteListSwitchReceiver implements Receiver {
    @Autowired
    private IRMFeignClientService irmFeignClientService;
    @Override
    public String parseMessage(String data) {
        // *WT,866248050395985,V4,CALLFILTER,101247,1,030621,FFFFDFFF#
        String[] split = data.split(",");
        String imei=split[1];
        String messageType = split[2];
        String type = split[3];
        String commandNumber=split[4];
        String flag=split[5];
        String deviceDate = split[6];
        String deviceStatus=split[7];//设备状态
        MqGeneralSwitchResult mqGeneralSwitchResult = new MqGeneralSwitchResult();
        mqGeneralSwitchResult.setImei(imei);
        mqGeneralSwitchResult.setDeviceTime(commandNumber);
        mqGeneralSwitchResult.setCommandNumber(commandNumber);
        mqGeneralSwitchResult.setResult(Integer.parseInt(flag));
        mqGeneralSwitchResult.setDeviceStatus(deviceStatus);
        mqGeneralSwitchResult.setDeviceDate(deviceDate);
        InjectFeignService.getIrmFeignClientService().whiteCallSwitch(mqGeneralSwitchResult);
        return "";
    }
}
